package com.trade.wzj.service.xiang;

import com.trade.wzj.dao.xiang.SupplierQuotaDao;
import com.trade.wzj.model.xiang.SupplierQuota;

public class SupplierQuotaimpl implements SupplierQuotaService {
	private SupplierQuotaDao mapper;

	public SupplierQuotaDao getMapper() {
		return mapper;
	}

	public void setMapper(SupplierQuotaDao mapper) {
		this.mapper = mapper;
	}

	/*
	 * (non-Javadoc)供应商报价列表添加方法
	 * 
	 * @see
	 * com.trade.wzj.service.xiang.SupplierQuotaService#SupplierQuotaAdd(com.trade.
	 * wzj.model.xiang.SupplierQuota)
	 */
	@Override
	public boolean SupplierQuotaAdd(SupplierQuota sq) throws Exception {
		if (sq.getSupplierquotaID().equals("")) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} else if (sq.getSupplierID()  == null) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else if(sq.getQuotaDates().equals("")) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else if (sq.getPayID() == null) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else if(sq.getRemark().equals("")) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else {
			int result = mapper.SupplierQuotaAdd(sq);
			if (result > 0) {
				System.out.println("添加成功");
			}
		}
		return true;
	}
	/*
	 * (non-Javadoc)供应商报价列表删除方法
	 * @see com.trade.wzj.service.xiang.SupplierQuotaService#SupplierQuotaDel(int)
	 */
	@Override
	public boolean SupplierQuotaDel(int id) throws Exception {
			int result = mapper.SupplierQuotaDel(id);
			if (result > 0) {
				System.out.println("删除成功");
			}
		return true;
	}
}
